package com.jdcjk.util;

import com.jdcjk.project.main.model.entity.CarWarningInfo;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/1/12 0012.
 */

public class TerminalWarmingJudge {

    public static List<String> warmingJudge(CarWarningInfo carWarningInfo) {
        List<String> warnList = new ArrayList<>();
        if (carWarningInfo.isEmergencyAlarm()) {
            if (carWarningInfo.isIsUrgencyWarning0()) {
                warnList.add("紧急报警");
            }
            if (carWarningInfo.isIsSpeedWarning1()) {
                warnList.add("超速报警");
            }
            if (carWarningInfo.isIsTiredWarning2()) {
                warnList.add("疲劳驾驶");
            }
            if (carWarningInfo.isIsDangerWarning3()) {
                warnList.add("危险报警");
            }
            if (carWarningInfo.isIsGNSSWarning4()) {
                warnList.add("GNSS模块发送故障");
            }
            if (carWarningInfo.isIsGNSSWarning5()) {
                warnList.add("GNSS天线未接或被剪断");
            }
            if (carWarningInfo.isIsGNSSWarning6()) {
                warnList.add("GNSS天线短路");
            }
            if (carWarningInfo.isIsUndervoltageWarning7()) {
                warnList.add("终端主电源欠压");
            }
            if (carWarningInfo.isIsPowerDownWarning8()) {
                warnList.add("终端主电源掉电");
            }
            if (carWarningInfo.isIsLCDWarning9()) {
                warnList.add("终端LCD或显示器故障");
            }
            if (carWarningInfo.isIsTTSWarning10()) {
                warnList.add("TTS模块故障");
            }
            if (carWarningInfo.isIsCameraWarning11()) {
                warnList.add("摄像头故障");
            }
            if (carWarningInfo.isIsICCardWarning12()) {
                warnList.add("道路运输证IC卡模块故障");
            }
            if (carWarningInfo.isIsSpeedWarning13()) {
                warnList.add("超速预警");
            }
            if (carWarningInfo.isIsTiredWarning14()) {
                warnList.add("疲劳驾驶预警");
            }
            if (carWarningInfo.isIsDriveOvertimeWarning18()) {
                warnList.add("当天累计驾驶超时");
            }
            if (carWarningInfo.isIsOvertimeWarning19()) {
                warnList.add("超时停车");
            }
            if (carWarningInfo.isIsTurnoverAreaWarning20()) {
                warnList.add("进出区域");
            }
            if (carWarningInfo.isIsTurnoverPathWarning21()) {
                warnList.add("进出路线");
            }
            if (carWarningInfo.isIsDriveTimeoutWarning22()) {
                warnList.add("路段行驶时间不足/过长");
            }
            if (carWarningInfo.isIsPathDepartureWarning23()) {
                warnList.add("路线偏离报警");
            }
            if (carWarningInfo.isIsVSSWarning24()) {
                warnList.add("车辆VSS故障");
            }
            if (carWarningInfo.isIsOilmassWarning25()) {
                warnList.add("车辆油量异常");
            }
            if (carWarningInfo.isIsStealWarning26()) {
                warnList.add("车辆被盗");
            }
            if (carWarningInfo.isIsIllegalityIgnitionWarning27()) {
                warnList.add("车辆非法点火");
            }
            if (carWarningInfo.isIsIllegalityDisplacementWarning28()) {
                warnList.add("车辆非法位移");
            }
            if (carWarningInfo.isIsCrashWarning29()) {
                warnList.add("碰撞预警");
            }
            if (carWarningInfo.isIsOverturnWarning30()) {
                warnList.add("侧翻预警");
            }
            if (carWarningInfo.isIsIllegitmacyOpenWarning31()) {
                warnList.add("非法开门报警");
            }
        }
        return warnList;
    }

    /**
     * 为报警信息列表每条报警信息添加报警类别名称
     *
     * @param list
     * @return
     */
    public static List<CarWarningInfo> addWamingName(List<CarWarningInfo> list) {
        for (int i = 0; i < list.size(); i++) {
            //设置报警类型名
            list.get(i).setWarningList(warmingJudge(list.get(i)));
        }
        return list;
    }
}
